OneNote Defects

Tuesday, November 15, 2022

8:56 AM

These are support questions posted to the Microsoft Q&A Web site.

 

 

 

C# with .NET Framework 4.8, OneNote 16.0.15726.20188 64-bit

 

Using the Interop API, IApplication.NavigateToUrl(pageURL)

 

Invoke once with a valid page URL, it succeeds

 

Invoke again (within about two seconds) with a different valid page URL, it fails with COMException, HResult: 0x80042014 "The object does not exist"

 

However, if you wait at least about three seconds in between calls, then it will always succeed.

 

It doesn't matter whether the second page is in the same notebook or a different notebook. All notebooks tested here are synced to the cloud.

 

It appears that NavigateToUrl causes the notebook to sync, because the OneNote notebook panel shows the sync glyph on top of the notebook icon and that is perhaps blocking subsequent interop APIs until completed?

 

The IApplication instance is instantiated and disposed in a "using" block for each call

 

See also

Can you update the contents of a page reliably with PATCH ../notes/pages/{id}/content

April 2, 2022

Jason Chapman

 

 

 

 

C# with .NET Framework 4.8, OneNote 16.0.15726.20188 64-bit

 

Using the Interop API, IApplication.UpdatePageContent(xml, lastModTime, XMLSchema.xs2013, true)

 

Given a page with one Outline and two OE paragraphs where each OE paragraph was contributed by different authors on different dates.

 

If any change is made to the Outline, such as appending a new OE, without modifying the existing OEs, then when the page is saved using UpdatePageContent, the lastModifiedTime attribute of all descendants of that Outline are updated to the current time. This results in losing information regarding when a particular author applied their changes.

 

The expectation is that the EditedByAttributes (per 0336.OneNoteApplication_2013.xsd) of an OE should be preserved unless that OE's content has changed.

 

Users who share notebooks often rely on the EditedByAttributes (who and when) for individual parts of a page to track independent changes. The current behavior loses that auditing capability.

 

Note that this usage is based on  https://learn.microsoft.com/en-us/office/client-developer/onenote/application-interface-onenote#updatepagecontent-method which explains:

 

  • You must include page-level objects in the UpdatePageContent call
  • The dateExpectedLastModified is nothing more than a pessimistic locking type of safe-guard and is not considered in any regard in relation to the lastModifiedTime attribute

 

 

 

 

C# with .NET Framework 4.8, OneNote 16.0.16924.20150 64-bit

 

Using the interop API, IApplication.UpdatePageContent(xml, lastModTime, XMLSchema.xs2013, true)

 

Given a page with an OE paragraph, where the user selects a run of text, not including the end of the text, and the text contains spelling errors before, within, and after the selection range.

 

When the proofing language is changed for the selected range, then the spelling errors after that range will no longer be highlighted as errors.

 

Here is an example text run, before modification, with a selection range. Notice the word "benoyd" is misspelled and would be highlighted by OneNote.

 

  <one:OE alignment="left" quickStyleIndex="1" selected="partial">

    <one:T><![CDATA[To ]]></one:T>

    <one:T selected="all"><![CDATA[infinity]]></one:T>

    <one:T><![CDATA[ and benoyd...]]></one:T>

  </one:OE>

 

And after modification to change the language of the selected range:

 

  <one:OE alignment="left" quickStyleIndex="1">

    <one:T><![CDATA[<span

lang=en-US>To </span><span lang=yo>infinity</span><span lang=en-US> and benoyd...</span>]]></one:T>

  </one:OE>

 

But the word "benoyd" is no longer highlighted as misspelled. The user can manual iterate through the text by interactively clicking the Review/Spelling button, causing OneNote to highlight the misspellings.

 

Alternatively, if the user changes the proofing language of the selected range interactively using the Proofing Language panel, it results in exactly the same XML structure generated by OneNote natively, but OneNote retains the misspelling indicators.

 

Making exactly the same changes to the XML using the UpdatePageContent API should result in the same behavior as using the UI.

 

 

 

📓

OneNote Interop API targets wrong window instance

Nov 23, 2024

stemarcoh

 

C# with .NET Framework 4.8, Microsoft® OneNote® 2021 MSO (Version 2410 Build 16.0.18129.20100) 64-bit

 

Open up two OneNote windows viewing the same page. From the second window, invoke an add-in command that uses the managed Interop API.

 

Any queries or updates made by the API will target the first OneNote window instance, even while the second window instance is active and has focus.

 

However, if the content of the page is manually modified from the second [active] window instance, then and only then will the API call target and update the page in the second window.

 

Expectation is that the update content will be visible immediately in the active OneNote window instance.

 

 

 

#omwiki #omdeveloper #omtechnote

 

© 2020 Steven M Cohn. All rights reserved.

Please consider a sponsorship or one-time donation to support ongoing development

 

Created with OneNote.